<!DOCTYPE html>
<html>
    <head>
        <script src="js/vue.js"></script>
        <style>

            #A {
                background: red;
                height: 20px;
            }

            #B {
                background: blue;
                height: 20px;
            }

            #C {
                background: yellow;
                height: 20px;
            }
        </style>
    </head>
    <body>
        <div id="app">
            <button @click="showNum1">切换</button>
            <div>
                <transition name="row" mode="out-in">
                    <span v-bind:key="show" v-bind:id="show" >{{showNum}}</span>
                </transition>
            </div>
        </div>
        <script>
            var vm = new Vue({
                el:'#app',
                data : { show : 'A'},
                computed : {
                    showNum() {
                        switch(this.show){
                            case 'A': return '我是a'
                            case 'B': return '我是b'
                            case 'C': return '我是c'
                        }
                    }
                },
                methods : {
                    showNum1() {
                        if(this.show == 'A'){
                            this.show = 'B';
                        }
                        else if (this.show == 'B') {
                            this.show = 'C';
                        }
                        else{
                            this.show = 'A';
                        }
                    }
                }
            });
        </script>
    </body>
</html>